package com.m20studio.mop.activity;

import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.LinearLayout;

import com.m20studio.mop.R;

public class About extends Activity{
	
	private String url;
	private LinearLayout back;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.about); 
      		
        //返回
		back = (LinearLayout)findViewById(R.id.about_back);
		back.setOnClickListener(new View.OnClickListener() { 
            public void onClick(View v){
            	About.this.setResult(RESULT_OK);
            	About.this.finish();
              } 
		});
		
		
		//加载数据
		url = "file:///android_asset/about.html";
	    htmlHandler(url);

    }
    
    //发送url和页数
    public void htmlHandler(final String url){

    	final Handler handler = new Handler(){
    		
			@Override
			public void handleMessage(Message msg){
				if (msg.what == 1){
					WebView wv=(WebView) findViewById(R.id.about_content);

					WebSettings webSettings = wv.getSettings();
					webSettings.setSavePassword(false);
					webSettings.setSaveFormData(false);
					webSettings.setJavaScriptEnabled(true);
					webSettings.setSupportZoom(false);
					//去除滚动条背景
					wv.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
			        wv.setBackgroundColor(Color.TRANSPARENT);
					wv.loadUrl(url);
				}
			}
		};
    	new Thread(){
    		public void run(){
    			Looper.prepare();
    			try{
					Thread.sleep(100);

				}catch (InterruptedException e){
					e.printStackTrace();
				}
    			try{
    				
					
    			}catch(Exception e){
    				
    			}
    			Message m = new Message();
				m.what = 1;
				handler.sendMessage(m);
				Looper.loop();
    		}
    	}.start();
    }
    
}